#include<cstdio>
int main(){
	int m,n;
	scanf("%d %d",&n,&m);
	int c=(m-(2*n))/2;
	printf("%d %d",n-c,c);
} 
